package com.yl.auth.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yl.auth.model.entity.Cuoyi;
import com.yl.auth.model.entity.Xiaocuoyi;
import com.yl.auth.service.CuoyiService;
import com.yl.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 * @author ln
 * @since 2023-06-20
 */
@RestController
@RequestMapping("/admin/cuoyi")
@Api(tags = "养老护理-错衣缺衣")
public class CuoyiController {
    @Resource
    private CuoyiService cuoyiService;
    @GetMapping("/getcuoyi/{page}/{limit}")
    @ApiOperation(value = "获取全部错衣信息")
    public Result getcuoyi(@PathVariable @ApiParam("当前页") Integer page, @PathVariable @ApiParam("总条数") Integer limit, @ApiParam("护工姓名") String hgname,@ApiParam("返回时间") String fbtime,@ApiParam("类型") String type,@ApiParam("状态") Integer zhuangtai) {
        Page<Cuoyi> iPage = new Page<>(page, limit);
        Page<Cuoyi> pageVo = cuoyiService.getPageVo(iPage, hgname, fbtime, type, zhuangtai);
        return Result.ok(pageVo);
    }

    @GetMapping("/getcuoyiById/{id}")
    @ApiOperation(value = "根据Id查询")
    public Result getcuoyiById(@PathVariable @ApiParam("错衣缺衣id")Integer id){
        Cuoyi cuoyi = cuoyiService.getcuoyiById(id);
        return Result.ok(cuoyi);
    }


    @PutMapping("/updatezhuangtai/{id}")
    @ApiOperation(value = "修改状态")
    public Result updatezhuangtai(@PathVariable @ApiParam("错衣缺衣id")Integer id){
       cuoyiService.updatezhuangtai(id);
        return Result.ok();
    }


}
